﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DLM.Domain.Model;
using DLM.Domain.Repositories;
using DLM.Infrastructure.UnitOfWork;
using DLM.Infrastructure.Domain;
using Webdiyer.WebControls.Mvc;

namespace DLM.Data.EF.CodeFirst.Repositories
{
    public class LogRepository : Repository<Log, int>, ILogRepository
    {
        public LogRepository(UnitOfWork unitOfWork)
            : base(unitOfWork)
        {

        }

        public override IEnumerable<Log> FindAll(int pageIndex, int pageSize)
        {
            return this.ActiveContext.Log.OrderByDescending(l => l.Date).ToPagedList(pageIndex, pageSize);
        }

        public override IEnumerable<Log> FindAll(System.Linq.Expressions.Expression<Func<Log, bool>> query, int index, int count)
        {
            return this.ActiveContext.Log.Where(query).OrderByDescending(l => l.Date).ToPagedList(index, count);
        }
    }
}
